package com.levi.springextension;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

/** 6  7
 * @author shentong
 * @since 2023/1/12 13:05
 * bean初始化之前执行   给bean设置名字
 */
public class MyBean implements BeanNameAware, InitializingBean, DisposableBean {
    @Override
    public void setBeanName(String name) {

    }

    /**
     *
     * 在InitializingBean.afterPropertiesSet之前，
     * 在postProcessBeforeInitialization之后，
     */
    @PostConstruct
    public void init() {

    }

    /**
     * 初始化bean
     * 在postProcessAfterInitialization之前执行
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {

    }

    /**
     * bean销毁时候执行
     * @throws Exception
     */
    @Override
    public void destroy() throws Exception {

    }
}
